package com.mdxq.mall.sale.service.impl;

import com.mdxq.mall.sale.entity.HomeRecommendProduct;
import com.mdxq.mall.sale.mapper.HomeRecommendProductMapper;
import com.mdxq.mall.sale.service.HomeRecommendProductService;
import com.mybatisflex.spring.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * 人气推荐商品表 服务层实现。
 *
 * @author ShuJie
 * @since 2025-01-12
 */
@Service
public class HomeRecommendProductServiceImpl extends ServiceImpl<HomeRecommendProductMapper, HomeRecommendProduct>  implements HomeRecommendProductService{

    @Override
    @Transactional
    public boolean updateRecommendStatus(String ids, Integer recommendStatus) {
        for(String id:ids.split(",")){
            HomeRecommendProduct product=getById(id);
            product.setRecommendStatus(recommendStatus);
            mapper.update(product);
        }
        return true;
    }
}
